package ui.control
{
	import flash.events.MouseEvent;
	
	import ui.GuiEnum;

	/**
	 * 单选复选按扭 
	 * @author Administrator
	 * 
	 */	
	public class GuiCheckBox extends GuiButton
	{
		private var down:Boolean = false;
		
		public function GuiCheckBox()
		{
			super();
		}
		
		override public function init(xml:XML):void
		{
			super.Init(xml);
			
			if(xml.@down)
			{
				isDown = xml.@down;
			}
		}
		
		override protected function onBtnMouseOut(event:MouseEvent):void
		{
			if(star == GuiEnum.BTN_UP)
				return;
			star = isDown ? GuiEnum.BTN_DOWN : GuiEnum.BTN_UP;
		}
		
		override protected function onBtnMouseOver(event:MouseEvent):void
		{
			if(star == GuiEnum.BTN_OVER)
				return;
			star = GuiEnum.BTN_OVER;
		}
		
		override protected function onBtnMouseUp(event:MouseEvent):void
		{
			//m_star = 0;
		}
		
		override protected function onBtnMouseDwon(event:MouseEvent):void
		{
			isDown = !isDown;
		}
		
		public function get isDown():Boolean
		{
			return down;
		}

		public function set isDown(value:Boolean):void
		{
			down = value;
			star = down ? GuiEnum.BTN_DOWN: GuiEnum.BTN_UP;
		}

		
	}
}